package com.hua.demo03.dao;


import com.hua.demo03.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from user where username=#{username}")
    User getUserByName(String username);
    @Insert("INSERT into user(id,username,password) values (#{id},#{username},#{password})")
    void insertUser(User user);
    @Select("select * from user")
    @Cacheable("user:all")
    List<User> getAllUsers();
}
